namespace Graphix.Elements
{
    using System.Drawing;

    public interface ITextStyle
    {
        Font Font { get; set; }

        Color Color { get; set; }

        Brush ColorBrush { get; }
    }

    public class TextStyle : ITextStyle
    {
        public Font Font { get; set; }

        public Color Color { get; set; }

        public Brush ColorBrush
        {
            get
            {
                return new SolidBrush(Color);
            }
        }

        public static TextStyle Default
        {
            get
            {
                return new TextStyle("Arial", 12, Color.Black);
            }
        }

        public TextStyle(string fontName, float fontSize, Color color)
        {
            if (fontSize > 0)
            {
                this.Font = new Font(fontName, fontSize);
            }

            if (color == default(Color))
            {
                this.Color = Color.Black;
            }
            else
            {
                this.Color = color;
            }
        }

        public TextStyle()
        {
            
        }
    }

    public class ValuedTextStyle : TextStyle
    {
        public string Text { get; set; }

        public Horizontal Alignment { get; set; }

        public ValuedTextStyle(string text, string fontName = "Arial", float fontSize = 12, Color color = default(Color))
            : base(fontName, fontSize, color)
        {
            this.Text = text;
            this.Alignment = Horizontal.Center;
        }

        public ValuedTextStyle(string fontName = "Arial", float fontSize = 12, Color color = default(Color))
            : this(string.Empty, fontName, fontSize, color)
        {

        }

        public ValuedTextStyle() : this(string.Empty, string.Empty, 0)
        {

        }
    }
}